import java.util.StringTokenizer;


class P11220_39643 {

	public static void main(String[] args) {
		int cases = Integer.parseInt(readLn());
		readLn();
		for (int k = 0; k < cases; k++) {
			System.out.println("Case #" + (k + 1) + ":");
			process();
			
			if (k + 1 != cases) System.out.println();
		}
	}
	
	
    private static void process() {
		
    	String line = readLn();
    	
    	while (line != null && !"".equals(line)) {
    		process(line);
    		
    		line = readLn();
    		
    	}
		
	}


	private static void process(String line) {
		StringTokenizer st = new StringTokenizer(line);
		int index = 0;
		
		StringBuffer sb = new StringBuffer();
		
		while (st.hasMoreTokens()) {
		
			String word = st.nextToken();
			
			if (index < word.length() ) {
				sb.append(word.charAt(index));
				index++;
			}
			
		}
		
		System.out.println(sb.toString());
		
	}


	static String readLn() {
        String newLine = System.getProperty("line.separator");
        StringBuffer buffer = new StringBuffer();
        int car = -1;
        try {
            car = System.in.read();
            while ((car > 0) && (car != newLine.charAt(0))) {
                buffer.append((char)car);
                car = System.in.read();
            }
            if (car == newLine.charAt(0))
            System.in.skip(newLine.length() - 1);
        } catch (java.io.IOException e) { return (null);}
        if ((car < 0) && (buffer.length() == 0)) return (null);
        return (buffer.toString());
    }

}
